home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / usr / share / uim / direct.scm < prev    next >
Encoding:
Text File  |  2010-11-07  |  4.2 KB  |  149 lines

  1. ;;;
  2. ;;; Copyright (c) 2003-2009 uim Project http://code.google.com/p/uim/
  3. ;;;
  4. ;;; All rights reserved.
  5. ;;;
  6. ;;; Redistribution and use in source and binary forms, with or without
  7. ;;; modification, are permitted provided that the following conditions
  8. ;;; are met:
  9. ;;; 1. Redistributions of source code must retain the above copyright
  10. ;;;    notice, this list of conditions and the following disclaimer.
  11. ;;; 2. Redistributions in binary form must reproduce the above copyright
  12. ;;;    notice, this list of conditions and the following disclaimer in the
  13. ;;;    documentation and/or other materials provided with the distribution.
  14. ;;; 3. Neither the name of authors nor the names of its contributors
  15. ;;;    may be used to endorse or promote products derived from this software
  16. ;;;    without specific prior written permission.
  17. ;;;
  18. ;;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND
  19. ;;; ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  20. ;;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  21. ;;; ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE
  22. ;;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  23. ;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  24. ;;; OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  25. ;;; HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  26. ;;; LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  27. ;;; OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  28. ;;; SUCH DAMAGE.
  29. ;;;;
  30.  
  31. ;;; user configs
  32.  
  33. ;; widgets and actions
  34.  
  35. ;; widgets
  36. (define direct-widgets '(widget_direct_input_mode))
  37.  
  38. ;; default activity for each widgets
  39. (define default-widget_direct_input_mode 'action_direct_direct)
  40.  
  41. ;; actions of widget_direct_input_mode
  42. (define direct-input-mode-actions
  43.   '(action_direct_direct))
  44.  
  45.  
  46. ;;; implementations
  47.  
  48. (register-action 'action_direct_direct
  49.          (lambda (dc)
  50.            (list
  51.             'direct_input
  52.             "-"
  53.             (N_ "direct")
  54.             (N_ "Direct Input Mode")))
  55.          (lambda (dc)
  56.            #t)
  57.          #f)  ;; no action handler
  58.  
  59. ;; Update widget definitions based on action configurations. The
  60. ;; procedure is needed for on-the-fly reconfiguration involving the
  61. ;; custom API
  62. (define direct-configure-widgets
  63.   (lambda ()
  64.     (register-widget 'widget_direct_input_mode
  65.              (activity-indicator-new direct-input-mode-actions)
  66.              (actions-new direct-input-mode-actions))))
  67.  
  68. (define direct-context-rec-spec context-rec-spec)
  69. (define-record 'direct-context direct-context-rec-spec)
  70. (define direct-context-new-internal direct-context-new)
  71.  
  72. (define direct-context-new
  73.   (lambda args
  74.     (let ((dc (apply direct-context-new-internal args)))
  75.       (direct-context-set-widgets! dc direct-widgets)
  76.       dc)))
  77.  
  78. (define direct-push-back-mode
  79.   (lambda (dc lst)
  80.     (if (car lst)
  81.     (begin
  82.       (im-pushback-mode-list dc (caar lst))
  83.       (direct-push-back-mode dc (cdr lst))))))
  84.  
  85. (define direct-init-handler
  86.   (lambda (id im arg)
  87.     (let ((dc (direct-context-new id im)))
  88.       ;;(im-clear-mode-list dc)
  89.       ;;(direct-push-back-mode dc im-list)
  90.       ;;(im-update-mode-list dc)
  91.       ;;(im-update-mode dc (- (length im-list) 1))
  92.       dc)))
  93.  
  94. (define direct-release-handler
  95.   (lambda (dc)
  96.     #f))
  97.  
  98. (define direct-key-press-handler
  99.   (lambda (dc key state)
  100.     (im-commit-raw dc)))
  101.  
  102. (define direct-key-release-handler
  103.   (lambda (dc key state)
  104.     (im-commit-raw dc)))
  105.  
  106. (define direct-reset-handler
  107.   (lambda (dc)
  108.     #f))
  109.  
  110. ;;(define direct-mode-handler
  111. ;;  (lambda (dc mode)
  112. ;;    (create-context (direct-context-id dc)
  113. ;;                #f
  114. ;;                (car (nth mode im-list)))
  115. ;;    #f))
  116.  
  117. (define direct-get-candidate-handler
  118.   (lambda (dc idx)
  119.     #f))
  120.  
  121. (define direct-set-candidate-index-handler
  122.   (lambda (dc idx)
  123.     #f))
  124.  
  125. (direct-configure-widgets)
  126.  
  127. (register-im
  128.  'direct
  129.  "*"  ;; wildcard language. see i18n.scm
  130.  "UTF-8"
  131.  (N_ "Direct")
  132.  (N_ "Pass through all user input without any modification")
  133.  #f
  134.  direct-init-handler
  135.  direct-release-handler
  136.  context-mode-handler
  137.  direct-key-press-handler
  138.  direct-key-release-handler
  139.  direct-reset-handler
  140.  direct-get-candidate-handler
  141.  direct-set-candidate-index-handler
  142.  context-prop-activate-handler
  143.  #f
  144.  #f
  145.  #f
  146.  #f
  147.  #f
  148.  )
  149.